package com.gylang.sso.service.impl;

import com.gylang.sso.domain.SysMenu;
import com.gylang.sso.repository.SysMenuRepository;
import com.gylang.sso.service.SysMenuService;
import com.gylang.sso.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;


/**
 * @author gylang,
 * @data 2019/11/17 16:25,
 * @DESC
 */
@Service
public class SysMenuServiceImpl implements SysMenuService {

    @Autowired
    private SysMenuRepository sysMenuRepository;
    @Autowired
    private SysUserService sysUserService;

    @Override
    public List<SysMenu> findByUsername(String userName) {
        if(userName == null || "".equals(userName) || "admin".equalsIgnoreCase(userName)) {

            return sysMenuRepository.findAll();
    }
        return sysMenuRepository.findByUserName(userName);
    }
}
